 |
 |
 |
 |
#219764 - 08/29/02 09:58 PM
Re: Last Post By 6.1
[Re: sjsaunders]
|
That 70's Guy
Registered: 06/24/01
Posts: 4097
|
There are some cases where the "last post by" information isn't being updated when a reply is deleted. Below is what I believe is the fix. Let me know otherwise.. <img src="/forum/images/icons/wink.gif" alt="" /><br /><br />In the instructions change this:<br /><br /><pre><font class="small">code:</font><hr><br />Step 7.<br /> In your deletepost.php script find this:<br /><br /> <br /> // ------------------------------------------------------------<br /> // We also need to decrease the number of replies in this topic<br /> $query = " <br /> UPDATE w3t_Posts<br /> SET B_Replies = B_Replies -1<br /> WHERE B_Number = '$Main'<br /> ";<br /> $dbh -> do_query($query);<br /><br /> <br /> and change it to this:<br /><br /> <br /> $query = "<br /> SELECT B_Number,B_Username,B_Approved<br /> FROM w3t_Posts<br /> WHERE B_Board = '$Board_q'<br /> AND B_Approved = 'yes'<br /> AND B_Main = '$Main'<br /> AND B_Main <> B_Number<br /> ORDER BY B_Number DESC<br /> LIMIT 1<br /> ";<br /> $lastPost = $dbh -> do_query($query); <br /> list($lastNumber,$lastName,$lastApproved) = $dbh -> fetch_array($lastPost);<br /> $lastName = addslashes($lastName);<br /><br /> // ------------------------------------------------------------<br /> // We also need to decrease the number of replies in this topic<br /> $query = " <br /> UPDATE w3t_Posts<br /> SET B_Replies = B_Replies -1,<br /> B_Last_Number = '$lastNumber',<br /> B_Last_Name = '$lastName',<br /> B_Last_Approved = '$lastApproved' <br /> WHERE B_Number = '$Main'<br /> ";<br /> $dbh -> do_query($query); <br /><br /></pre><hr><br /><br />to this:<br /><br /><pre><font class="small">code:</font><hr><br />Step 7.<br /> In your deletepost.php script find this:<br /><br /> <br /> // ------------------------------------------------------------<br /> // We also need to decrease the number of replies in this topic<br /> $query = " <br /> UPDATE w3t_Posts<br /> SET B_Replies = B_Replies -1<br /> WHERE B_Number = '$Main'<br /> ";<br /> $dbh -> do_query($query);<br /><br /> <br /> and change it to this:<br /><br /> <br /> $query = "<br /> SELECT B_Main,B_Number,B_Username,B_Approved<br /> FROM w3t_Posts<br /> WHERE B_Board = '$Board_q'<br /> AND B_Approved = 'yes'<br /> AND B_Main = '$Main'<br /> ORDER BY B_Number DESC<br /> LIMIT 1<br /> ";<br /> $lastPost = $dbh -> do_query($query); <br /> list($lastMain,$lastNumber,$lastName,$lastApproved) = $dbh -> fetch_array($lastPost);<br /> $lastName = addslashes($lastName);<br /> if ($lastMain == $lastNumber) {<br /> // It's the main post therefore no replies left, right?<br /> $lastNumber = "";<br /> $lastName = "";<br /> $lastApproved = "";<br /> }<br /><br /> // ------------------------------------------------------------<br /> // We also need to decrease the number of replies in this topic<br /> $query = " <br /> UPDATE w3t_Posts<br /> SET B_Replies = B_Replies -1,<br /> B_Last_Number = '$lastNumber',<br /> B_Last_Name = '$lastName',<br /> B_Last_Approved = '$lastApproved' <br /> WHERE B_Number = '$Main'<br /> ";<br /> $dbh -> do_query($query); <br /><br /></pre><hr><br /><br />This may or may not be the cure but it is fixing a flaw in the code none the less. <img src="/forum/images/icons/smile.gif" alt="" />
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#219789 - 09/25/02 12:57 PM
Re: Last Post By 6.1
[Re: sf49rminer]
|
I type Like navaho
Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
|
Actually my 6.1 instructions above are a bit more complete.<br /><br />In 6.1 postlist.php uses $File in the select and list line to tell if there's an attachment and add the disk Icon if needed. <br /><br />Edit: As well as the posterid variable:<br /><br />Step 2.<br /> In your postlist.php script find this:<br /><br /><br /> SELECT t1.B_Number,t1.B_Parent,t1.B_Username,t1.B_Posted,t1.B_Last_Post,t1.B_Subject,t1.B_Main,t1.B_Status,t1.B_Approved,t1.B_Icon, t1.B_Reged,t1.B_Counter,t1.B_Sticky,t1.B_Replies,t1.B_Rating,t1.B_Rates,t1.B_RealRating,t2.U_Color,t2.U_Status,t1.B_PosterId,t1.B_File<br /><br /><br /> and change it to this:<br /><br /> <br /> SELECT t1.B_Number,t1.B_Parent,t1.B_Username,t1.B_Posted,t1.B_Last_Post,t1.B_Last_Number,t1.B_Last_Name,t1.B_Last_Approved,t1.B_Subject,t1.B_Main,t1.B_Status,t1.B_Approved,t1.B_Icon, t1.B_Reged,t1.B_Counter,t1.B_Sticky,t1.B_Replies,t1.B_Rating,t1.B_Rates,t1.B_RealRating,t2.U_Color,t2.U_Status,t1.B_PosterId,t1.B_File<br /><br /> <br /> Find this:<br /><br /> <br /> list($Number,$Parent,$Username,$Posted,$Last_Post,$Subject,$Main,$Open,$Approved,$icon,$Reged,$Counter, $Sticky,$Replies,$Rating,$Rates,$stars,$Color,$PostStatus,$posterid,$file) = $dbh -> fetch_array($sth);<br /><br /><br /> and change it to this:<br /><br /> <br /> list($Number,$Parent,$Username,$Posted,$Last_Post,$Last_Number,$Last_Name,$Last_Approved,$Subject,$Main,$Open,$Approved,$icon,$Reged,$Counter $Sticky,$Replies,$Rating,$Rates,$stars,$Color,$PostStatus,$posterid,$file) = $dbh -> fetch_array($sth);<br /><br /><br />
Edited by JoshPet (09/25/02 01:01 PM)
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|